Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext


~Tip Nontumimanoopsi 17.Oct.02 08:33 PM a Web browser
Domino Designer All Releases All Platforms


I'm hoping someone out there with a greater knowledge of agents, LotusScript and OLE than me (Julie Kadashevich, are you out there???) can help figure out a perplexing problem.

I have a LotusScript agent trigger when new documents of a certain form are created or modified that's primary purpose is to launch CorelDRAW 10 through OLE to create dynamic CorelDRAW files based on data from the Notes database.

By and large, it's been running great, but the perplexing part is trying to get Corel to quit when the agent is all done.

My main questions are...

1. Why does the Corel process linger on the server even though the agent has called the cdrApp.Quit method?

2. Is there another way to access external programs (like Corel, Word, Excel) other than OLD automation? For example, by declaring functions as you would for Windows API calls. Incidentally, the Corel object library is a tlb file, not a dll.

3. If OLE automation is the way to go, is there a more guaranteed way of making sure that the agent truely kills Corel when it's all done? I've tried a shell command to kill the process, I've also tried setting cdrApp = Nothing.

Any insight into the inner workings of how LotusScript interacts with other applications via OLE would be greatly appreciated.

--Jon Kramme

---------------------------------------------
Here's an abbreviated sample of the code...

Sub Initialize
On Error Goto ErrorHandler

Dim session As NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim cdrApp As Variant
Dim cdrDoc As Variant
Dim cdrLayer As Variant
Dim cdrShape As Variant
Dim cdrText As Variant

Set session = New NotesSession
Set db = session.CurrentDatabase
Set view = db.GetView("ShoppingCart")
Set doc = view.GetFirstDocument

Set cdrApp = CreateObject("CorelDraw.Application.10")

While Not (doc Is Nothing)
Set cdrDoc = cdrApp.CreateDocumentFromTemplate("C:\SomeTemplate.cdt", True)
Set cdrLayer = cdrDoc.ActiveLayer
Set cdrShape = cdrLayer.FindShape("SomeTextShapeInTheTemplateFile")
Set cdrText = cdrShape.Text

Call cdrText.Replace("OldText", doc.SomeTextField(0), False, 1, True, False, 1)
Call cdrText.ConvertToArtistic
Call cdrShape.ConvertToCurves
Set cdrShape = cdrLayer.FindShape("PageBorder")

Call cdrShape.Fill.ApplyNoFill
Call cdrDoc.Export("C:\" & doc.UniversalID & ".ai", cdrAI, cdrCurrentPage, Nothing)

cdrShape.Outline.Width = 0.01
Call cdrDoc.Export("C:\" & doc.UniversalID & ".jpg", cdrJPEG, cdrCurrentPage, Nothing)

Call cdrDoc.SaveAs("C:\" & doc.UniversalID & ".cdr", Nothing)
Call cdrDoc.Close
Kill "C:\" & doc.UniversalID & ".cdr"

Set doc = view.GetNextDocument(doc)
Wend

Call cdrApp.Quit
Exit Sub

ErrorHandler:
Msgbox "CreateImageFiles (Agent) : Initialize at line " & Erl & " - " & Error$
If Not cdrDoc Is Nothing Then
tmpFile = strPath & "error.cdr"
Call cdrDoc.SaveAs(tmpFile, Nothing)
Call cdrDoc.Close
Kill tmpFile
End If
If Not cdrApp Is Nothing Then
Call cdrApp.Quit
End If
End
End Sub






OLE Calls to CorelDRAW from LotusSc... (~Tip Nontumiman... 17.Oct.02)
. . RE: OLE Calls to CorelDRAW from Lot... (~Bill Frokimari... 17.Oct.02)
. . . . RE: OLE Calls to CorelDRAW from Lot... (~Tip Nontumiman... 18.Oct.02)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS